<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" class="login_page">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录</title>

    <link rel="shortcut icon" th:href="@{/assets/img/favicon/favicon.ico}" type="image/x-icon">
    <link rel="icon" th:href="@{/assets/img/favicon/favicon.ico}" type="image/x-icon">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/bootstrap.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/login.css}">

    <style>
        .top_b{
            font-weight: bold;
        }
    </style>
</head>

<body>


<div class="login_box">
    <form method="post" id="login-form" class="from-inline">
        <div class="top_b">
            管理平台
        </div>
        <div class="alert alert-info alert-login">

        </div>
        <div class="cnt_b">
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                    <input class="form-control input-sm" type="text" name="username" placeholder="Login name"  />
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                    <input class="form-control input-sm" type="password" name="password" placeholder="Password"  />
                </div>
            </div>
            <div class="form-group" th:if="${isCaptcha}" >
                <div class="col-xs-6" style="padding-left: 0px;">
                    <input class="form-control input-sm" type="text" name="captcha" placeholder="Captcha"  />
                </div>
                <div class="col-xs-6" style="padding-left: 0px;">
                    <img id="captcha-img" class="captcha-img" th:src="@{/captcha}" onclick="changeCode()"/>
                </div>

            </div>

            <div class="form-group">
                <div class="input-group">
                    <input type="checkbox" name="rememberMe" title="记住我"> 7天自动登录
                </div>
            </div>

        </div>
        <div class="btm_b clearfix">
            <button class="btn btn-default btn-sm pull-right" type="submit">Sign In</button>
        </div>
    </form>

</div>
<div style="text-align: center;position: relative;top: 25%;">
    Copyright © 2022 zuoyy.
</div>



<!--================================================== -->

<div th:replace="common/htmlJS::common_js(~{::script})">

<script>

    $(function () {
            $("#login-form").validate({
                submitHandler : function(form) {
                    zy.ajaxSubmit(form, {
                        url : basePath+'/login',
                        success : function(result) {
                            if (result.code == 200) {
                                window.location.href = basePath+'/system/index.shtml';
                            } else {
                                layer.alert(result.msg, {icon: 2});
                            }

                        }
                    });
                }

            });

    });
    function changeCode(){
        $('#captcha-img').attr("src", basePath+'/captcha?'+Math.random());
    }

</script>
</div>

</body>
</html>